﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeBehind="DispatchEntry.aspx.cs" Inherits="GPSTracker.Views.Delivery.DispatchEntry" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <link href="../CSS/DispatchEntry.css" rel="stylesheet" />
    <script src="../JS/DispatchEntry.js"></script>

    <script src="../JS/jquery-1.10.2.js"></script>

    <script language="javascript" type="text/javascript">

        function Fade(div) {
            setTimeout("document.getElementById('" + div + "').style.display='none'", 4000);
            setTimeout("document.getElementById('" + div + "').value = ''", 4000);
        }

        function showLoadingPanelDemo() {
            clientLoadingPanelDemo.Show();
        }

        function hideLoadingPanelDemo() {
            clientLoadingPanelDemo.Hide();
        }
    </script>

    <asp:ScriptManager ID="scrptMgr" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpMain" runat="server" UpdateMode="Conditional">
        <ContentTemplate>

            <script type="text/javascript">
                $(window).ready(function () {

                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);

                });
                $(window).resize(function () {

                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);

                });
                var prm = Sys.WebForms.PageRequestManager.getInstance();

                prm.add_endRequest(function () {
                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);
                });
            </script>

            <style type="text/css">
                #container
                {
                    position: relative;
                    min-height: 150px;
                }

                #sidebar
                {
                    position: absolute;
                    left: 0;
                    top: 0;
                    height: 100%;
                    width: 100%;
                    overflow-y: scroll;
                }
            </style>

            <dx:ASPxLoadingPanel ID="ASPxLoadingPanelDemo" runat="server" 
                ClientInstanceName="clientLoadingPanelDemo">
            </dx:ASPxLoadingPanel>
            <dx:ASPxCallback ID="ASPxCallbackDemo" runat="server" 
                        ClientInstanceName="clientCallbackDemo" >
                        <ClientSideEvents EndCallback="function(s, e) {
			                hideLoadingPanelDemo();
		                }" />
                    </dx:ASPxCallback>
            <div id="container">
                <div id="sidebar">
                    <table cellspacing="5" cellpadding="5" width="98%" border="0" align="center">

                        <tr>
                            <td style="width: 100%; height: 100%; text-align: center;">
                                <fieldset class="FiledSetDesign">
                                    <legend class="PageHeading" align="center">
                                        <asp:Label ID="lblHead" runat="server" Text="Dispatch Entry"></asp:Label>
                                    </legend>
                                    <table style="width: 100%; height: 100%" align="center" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td style="padding: 5px; width: 100%; text-align: center;">
                                                <table>
                                                    <tr>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="Select Area :"></dx:ASPxLabel>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxComboBox ID="cmbArea" runat="server"
                                                                IncrementalFilteringMode="Contains"
                                                                OnDataBound="cmb_DataBound" CssClass="AllControlls_TextBox">
                                                            </dx:ASPxComboBox>
                                                        </td>
                                                        <td>
                                                            <dx:ASPxButton ID="btnGo" runat="server" Text="Show Records" OnClick="btnGo_Click"></dx:ASPxButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 5px; width: 100%; height: 100%; overflow: auto;">
                                                <dx:ASPxGridView ID="grdView" runat="server" Width="100%" AutoGenerateColumns="False"
                                                    ClientInstanceName="grdView" OnCustomButtonCallback="grdView_CustomButtonCallback"
                                                    KeyFieldName="DeliveryEntryID" EnableCallBacks="False" DataSourceID="SqlDataSource1"
                                                    OnAfterPerformCallback="grdView_AfterPerformCallback">
                                                    <Columns>
                                                        <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="1">
                                                            <ClearFilterButton Visible="True">
                                                            </ClearFilterButton>
                                                        </dx:GridViewCommandColumn>
                                                        <dx:GridViewDataColumn FieldName="DeliveryEntryID" VisibleIndex="2" Visible="false"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="OrderNo" Caption="Order No." VisibleIndex="3"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataDateColumn FieldName="OrderDate" Caption="Order Date" VisibleIndex="4">
                                                            <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy">
                                                            </PropertiesDateEdit>
                                                        </dx:GridViewDataDateColumn>
                                                        <dx:GridViewDataColumn FieldName="BillNo" Caption="Bill No" VisibleIndex="5"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataDateColumn FieldName="BillDate" Caption="Bill Date" VisibleIndex="6">
                                                            <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy">
                                                            </PropertiesDateEdit>
                                                        </dx:GridViewDataDateColumn>
                                                        <dx:GridViewDataColumn FieldName="WhouseID" Caption="Warehouse" Visible="false" VisibleIndex="7"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="WhouseCode" Caption="Warehouse Code" VisibleIndex="8"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="BranchID" Caption="Branch ID" Visible="false" VisibleIndex="9"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="BranchCode" Caption="Branch Code" VisibleIndex="10"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="CustName" Caption="Customer Name" VisibleIndex="11"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address1" Caption="Address1" VisibleIndex="12"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address2" Caption="Address2" VisibleIndex="13"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address3" Caption="Address3" VisibleIndex="14"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address4" Caption="Address4" VisibleIndex="15"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="City" Caption="City" VisibleIndex="16"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Pincode" Caption="Pincode" VisibleIndex="17"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="AreaID" Caption="Area ID" Visible="false" VisibleIndex="18"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="AreaName" Caption="Area Name" VisibleIndex="19"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="ContactNo" Caption="ContactNo" VisibleIndex="20"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="EmailID" Caption="Email ID" VisibleIndex="21"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="MODEL_CODE" Caption="Model Code" VisibleIndex="22"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="MODEL_TYPE" Caption="Model Type" VisibleIndex="23"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="ITEM_DESC" Caption="Item Desc." VisibleIndex="24"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="CHASIS_NO" Caption="Chasis No." VisibleIndex="25"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Qty" Caption="Quantity" VisibleIndex="26"></dx:GridViewDataColumn>
                                                    </Columns>
                                                    <Settings ShowFilterRow="True" HorizontalScrollBarMode="Auto" />
                                                    <SettingsPager PageSize="20">
                                                        <PageSizeItemSettings Visible="true" Items="20, 50, 100, 200"/>
                                                    </SettingsPager>
                                                    <SettingsBehavior ColumnResizeMode="Control" />
                                                </dx:ASPxGridView>
                                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MainConn %>"></asp:SqlDataSource>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="5" style="padding: 5px; width: 100%; height: 100%; overflow: auto;">
                                                <table>
                                                    <tr>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxLabel ID="lbl1" runat="server" Text="Select Tempo :"></dx:ASPxLabel>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxComboBox ID="cmbTempo" runat="server"
                                                                IncrementalFilteringMode="Contains"
                                                                OnDataBound="cmb_DataBound" CssClass="AllControlls_TextBox">
                                                            </dx:ASPxComboBox>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="Select Delivery Boy :"></dx:ASPxLabel>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxComboBox ID="cmbDeliveryBoy" runat="server"
                                                                IncrementalFilteringMode="Contains"
                                                                OnDataBound="cmb_DataBound" CssClass="AllControlls_TextBox">
                                                            </dx:ASPxComboBox>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxButton ID="btnAssign" runat="server" Text="Dispatch" OnClick="btnAssign_Click" Width="80">
                                                                <ClientSideEvents Click="function(s, e)
                                                                {
                                                                    if(Validate() == true)
                                                                    {
                                                                        e.processOnServer = true;
                                                                        showLoadingPanelDemo();	
							                                            clientCallbackDemo.PerformCallback('callback');
                                                                    }
                                                                    else
                                                                    {
                                                                        e.processOnServer = false;
                                                                    }
                                                                }
                                                            " />
                                                            </dx:ASPxButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <%-- <tr>
                                            <td colspan="5" style="padding: 5px; width: 100%; height: 100%; overflow: auto;">
                                                <dx:ASPxButton ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click"></dx:ASPxButton>
                                            </td>
                                        </tr>--%>
                                    </table>
                                </fieldset>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
